using MicroMsg.Manager;
using MicroMsg.UI.Page;
using System;
using System.IO.IsolatedStorage;
namespace MicroMsg.Storage
{
	public class SettingsStorage
	{
		private static object settingLocked = new object();
		public static int count()
		{
			return IsolatedStorageSettings.get_ApplicationSettings().get_Count();
		}
		public static void load(SysSettings settings)
		{
			lock (SettingsStorage.settingLocked)
			{
				IsolatedStorageSettings applicationSettings = IsolatedStorageSettings.get_ApplicationSettings();
				settings.nDeviceID = (applicationSettings.Contains("nDeviceID") ? ((int)applicationSettings.get_Item("nDeviceID")) : 0);
				settings.nDeviceType = (applicationSettings.Contains("nDeviceType") ? ((int)applicationSettings.get_Item("nDeviceType")) : 0);
				settings.strUsrName = (applicationSettings.Contains("strUsrName") ? ((string)applicationSettings.get_Item("strUsrName")) : "");
				settings.strLastLoginName = (applicationSettings.Contains("strLastLoginName") ? ((string)applicationSettings.get_Item("strLastLoginName")) : "");
				settings.bIsVibrateOn = (!applicationSettings.Contains("bIsVibrateOn") || (bool)applicationSettings.get_Item("bIsVibrateOn"));
				settings.bIsSoundOn = (applicationSettings.Contains("bIsSoundOn") && (bool)applicationSettings.get_Item("bIsSoundOn"));
				settings.bIsNewMsgNotifyOn = (!applicationSettings.Contains("bIsNewMsgNotifyOn") || (bool)applicationSettings.get_Item("bIsNewMsgNotifyOn"));
				settings.bNewMsgWithoutDetail = (applicationSettings.Contains("bNewMsgWithoutDetail") && (bool)applicationSettings.get_Item("bNewMsgWithoutDetail"));
				settings.bIsPlayBySpeakPhone = (!applicationSettings.Contains("bIsPlayBySpeakPhone") || (bool)applicationSettings.get_Item("bIsPlayBySpeakPhone"));
				settings.lastUpdatePromptedClientVersion = (applicationSettings.Contains("lastUpdatePromptedClientVersion") ? ((uint)applicationSettings.get_Item("lastUpdatePromptedClientVersion")) : 0u);
				settings.themeType = (applicationSettings.Contains("themeType") ? ((MMThemeTypes)applicationSettings.get_Item("themeType")) : MMThemeTypes.COOL_BLACK_THEME);
				settings.strLastSystemLanguage = (applicationSettings.Contains("strLastSystemLanguage") ? ((string)applicationSettings.get_Item("strLastSystemLanguage")) : "");
				settings.strUserSetLanguage = (applicationSettings.Contains("strUserSetLanguage") ? ((string)applicationSettings.get_Item("strUserSetLanguage")) : "");
				settings.lastOSVersion = (applicationSettings.Contains("lastOSVersion") ? ((string)applicationSettings.get_Item("lastOSVersion")) : "");
			}
		}
	}
}
